<template>
    <el-card shadow="never">
        <el-button @click="showSearch = !showSearch">daf</el-button>
        <div>搜索框</div>
        <div>搜索框</div>
        <div v-show="showSearch">搜索框</div>
        <div v-show="showSearch">搜索框</div>
        <div v-show="showSearch">搜索框</div>
        <div v-show="showSearch">搜索框</div>
    </el-card>
    <div style="height: 10px"></div>
    <el-card shadow="never">
        <el-row justify="end" class="mt-n-10px">
            <el-button icon="plus" type="success" @click="">新增</el-button>
        </el-row>
        <div style="height: 5px"></div>
        <el-table

                :class="{'showSearch':showSearch}"
                ref="tableRef"
                border
                :data="tableData"
                style="width: 100%">
            <el-table-column prop="date" label="Date" width="700"/>
            <el-table-column prop="name" label="Name" width="700"/>
            <el-table-column fixed="right" prop="address" width="300" label="Address"/>
        </el-table>
        <el-pagination style="margin-bottom: -20px" layout="prev, pager, next" :total="50"/>
    </el-card>
</template>

<style lang="scss" scoped>
  @import "src/style/theme";

  .el-table.showSearch {
    height: calc(#{$home_main_height} - 325px);
  }

  .el-table:not(.showSearch) {
    height: calc(#{$home_main_height} - 235px);
  }
</style>
<script lang="ts" setup>
    import {onMounted, ref} from "vue";

    onMounted(() => {
        window.addEventListener("resize", () => {
            console.log('1234')
        })
    })

    let showSearch = ref(false);
    let tableRef = ref();


    const tableData = [
        {
            date: '2016-05-03',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-02',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-04',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-01',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-03',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-02',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-04',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-01',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-03',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-02',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-04',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-01',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-01',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-01',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-01',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-01',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-01',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
        {
            date: '2016-05-011',
            name: 'Tom',
            address: 'No. 189, Grove St, Los Angeles',
        },
    ]

</script>
